package com.food.eat.controller;

import com.food.eat.service.FoodEatService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import javax.annotation.Resource;

/**
 * @Author:RenPu
 * @Date: 2020/7/18 23:10
 * @Version: 1.0
 * @description:
 */

@ApiIgnore    //此注解让swagger2忽略对此类，生成接口文档
//@RestController
public class StuFoodController {

    @Resource
    private FoodEatService foodEatService;


    /**
     * 测试方法
     *
     * @param id
     * @return
     */
    @GetMapping(value = "/getByStuInfo/{id}")
    public Object getByStuInfo(@PathVariable("id") int id) {
        return foodEatService.getStuInfo(id);
    }


    @PostMapping(value = "/saveStu")
    public Object saveStu() {
        foodEatService.saveStu();
        return "保存信息成功！！！-*-O(∩_∩)O哈哈~";
    }


    @PostMapping(value = "/updateStu/{id}")
    public Object updateStu(@PathVariable("id") int id) {
        foodEatService.updateOneStu(id);
        return "修改息成功！！！-*-O(∩_∩)O哈哈~";
    }


    @PostMapping(value = "/deleteStu/{id}")
    public Object deleteStu(@PathVariable("id") int id) {
        foodEatService.deleteOneStu(id);
        return "删除信息成功！！！-*-O(∩_∩)O哈哈~";
    }


}
